Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand scf dialect implementation #38

Merged
merged 7 commits into from
Oct 16, 2024
Merged

Expand scf dialect implementation #38

merged 7 commits into from
Oct 16, 2024

Conversation

amanda849
Copy link
Contributor

  • Added scf condition, while and yield ops
  • Added additional syntaxes for scf if
  • Implemented roundtrip testing for scf for, if and while using examples from https://mlir.llvm.org/docs/Dialects/SCFDialect/
  • Created an ast node with custom dump for argument assignment (fixes for roundtrip)

Copy link
Contributor

@tbennun tbennun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Some questions.

Comment on lines 54 to 58
if len(sys.argv) > 1:
exec(sys.argv[1])
else:
from pytest import main
main([__file__])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(sys.argv) > 1:
exec(sys.argv[1])
else:
from pytest import main
main([__file__])
from pytest import main
main([__file__])

Please don't add exec calls into the code (even if it's a main function of a test file). Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied this from test_linalg.py, so I'll make the change there too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And test_builder.py

@@ -23,7 +23,7 @@ class CallIndirectOperation(DialectOp):
@dataclass
class CallOperation(DialectOp):
func: mast.SymbolRefId
type: mast.FunctionType
type: Optional[mast.FunctionType] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there not be an accompanying lark change for this? Also, why would calls not have type information? Is that a new addition to MLIR?

Copy link
Contributor Author

@amanda849 amanda849 Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was probably a copy-paste problem with argtypes being a duplicate of type. It should just be using type in both syntaxes.

Will clean up the unused argtypes in CallIndirectOperation too.

@amanda849 amanda849 requested a review from tbennun October 2, 2024 23:10
Copy link
Contributor

@tbennun tbennun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now, thanks

@tbennun tbennun merged commit 4f0986a into spcl:master Oct 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants